package com.shuqi.common.utils;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.message.BasicNameValuePair;

import android.text.TextUtils;

import com.shuqi.common.LoginHelper;

public class MyUrlTools {

    /***
     * 网页阅读页保存书签时，从解码后的url里截取章节id
     * 
     * @param url
     * @return
     */
    public static String getChapterIdFromWebBookMarkUrl(String url) {
        if (TextUtils.isEmpty(url)) {
            return "";
        }
        String str = "chapterid=";
        int index = url.lastIndexOf(str);
        if (index > 0) {
            str = url.substring(index + str.length());
            int index2 = str.indexOf("&");
            if (index2 > -1) {
                str = str.substring(0, index2);
            }
        }
        return str;
    }
    
    /***
     * 网页阅读页保存书签时，从解码后的url里截取sorceid
     * 
     * @param url
     * @return
     */
    public static String getSourceIdFromWebBookMarkUrl(String url) {
        if (TextUtils.isEmpty(url)) {
            return "";
        }
        String str = "sourceid=";
        int index = url.lastIndexOf(str);
        if (index > 0) {
            str = url.substring(index + str.length());
            int index2 = str.indexOf("&");
            if (index2 > -1) {
                str = str.substring(0, index2);
            }
        }
        return str;
    }
    
}
